package cn.com.bob.messageboard.config;

import cn.com.bob.messageboard.interceptor.LoginInterceptor;
import cn.com.bob.messageboard.interceptor.TokenInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;


/**
 * @Author Bob
 * @Version：1.0
 * 自定义拦截器进行注册
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Resource
    private TokenInterceptor tokenInterceptor ;

    @Resource
    private LoginInterceptor loginInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {


        /*registry.addInterceptor(tokenInterceptor)
                .addPathPatterns("/message/add");*/

        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/message/add")
                .addPathPatterns("/message/exportExcel");

    }




}
